import { NgModule, ErrorHandler } from '@angular/core';
import { IonicApp, IonicModule, IonicErrorHandler,Config } from 'ionic-angular';
import { MyApp } from './app.component';

// 常量
import * as Constant from '../constant/constant';


// import
import { Modules, Pages, Providers } from './app.imports';

// 自定义过渡动画
import { ModalScaleUpEnterTransition } from '../animations/transitions/scale-up-enter.transition';
import { ModalScaleUpLeaveTransition } from '../animations/transitions/scale-up-leave.transition';

@NgModule({
  declarations: [
    // App Core
    MyApp,
    Pages,
  ],
  /***
   *  tabsHideOnSubPages: true, //隐藏子tab
   *  mode: 'ios', // ios风格
   * */
  imports: [
    Modules,
    IonicModule.forRoot(MyApp, {
      preloadModules: true,
      tabsHideOnSubPages: true,
      swipeBackEnabled: true,
      tabsPlacement: 'bottom',
      pageTransition: 'ios',
      cache: false,
    }),

  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    Pages,
  ],
  providers: [
    Providers,
    {provide: ErrorHandler, useClass: IonicErrorHandler},
  ]
})
export class AppModule {

    constructor(public config:Config)
    {
      this.setCustomTransitions();
    }

    private setCustomTransitions()
    {
      this.config.setTransition(Constant.MODAL_SCALE_UP_LEAVE,ModalScaleUpLeaveTransition);
      this.config.setTransition(Constant.MODAL_SCALE_UP_ENTER,ModalScaleUpEnterTransition);
      this.config.set("backButtonText","");
    }

}
